from Common.Base import Base,open_browser
login_url = "http://localhost:8080/ecshop/user.php"

"""
author:李孟洋
"""
class LoginPage(Base):
    username_loc = ('name','username')
    password_loc = ('name','password')
    remember_loc = ('name','remember')
    submit_loc = ('name','submit')
    text_loc = ('class name','f4_b')

    def input_username(self,username):
        """
        输入用户名
        :return:
        """
        self.send_keys(self.username_loc,username)

    def input_password(self,password):
        """
        输入密码
        :param password:
        :return:
        """
        self.send_keys(self.password_loc,password)

    def remember_password(self):
        """
        点击记住密码
        :return:
        """
        self.click(self.remember_loc)

    def click_login(self):
        """
        点击登录
        :return:
        """
        self.click(self.submit_loc)

    def get_login_username_boolean(self):
        """
        获取登录的用户名
        :return:
        """
        return self.get_element_text_boolean(self.text_loc)

